/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controlacciones.ejb3.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author vanessa
 */
@Entity
@Table(name = "tb_categoria_accion")
@NamedQueries({
    @NamedQuery(name = "TbCategoriaAccion.findAll", query = "SELECT t FROM TbCategoriaAccion t"),
    @NamedQuery(name = "TbCategoriaAccion.findByCodCatAccion", query = "SELECT t FROM TbCategoriaAccion t WHERE t.codCatAccion = :codCatAccion"),
    @NamedQuery(name = "TbCategoriaAccion.findByDescripcion", query = "SELECT t FROM TbCategoriaAccion t WHERE t.descripcion = :descripcion")})
public class TbCategoriaAccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cod_cat_accion")
    private String codCatAccion;
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(mappedBy = "codCatAccion")
    private Collection<TbTipoAccion> tbTipoAccionCollection;

    public TbCategoriaAccion() {
    }

    public TbCategoriaAccion(String codCatAccion) {
        this.codCatAccion = codCatAccion;
    }

    public String getCodCatAccion() {
        return codCatAccion;
    }

    public void setCodCatAccion(String codCatAccion) {
        this.codCatAccion = codCatAccion;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Collection<TbTipoAccion> getTbTipoAccionCollection() {
        return tbTipoAccionCollection;
    }

    public void setTbTipoAccionCollection(Collection<TbTipoAccion> tbTipoAccionCollection) {
        this.tbTipoAccionCollection = tbTipoAccionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codCatAccion != null ? codCatAccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TbCategoriaAccion)) {
            return false;
        }
        TbCategoriaAccion other = (TbCategoriaAccion) object;
        if ((this.codCatAccion == null && other.codCatAccion != null) || (this.codCatAccion != null && !this.codCatAccion.equals(other.codCatAccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //return "ejb3.entity.TbCategoriaAccion[codCatAccion=" + codCatAccion + "]";
        String toString = null;
        toString = this.getCodCatAccion() + "-" + this.getDescripcion();
        return toString;
    }
}
